package com.itshare.video.service.impl;

import com.itshare.video.common.aop.cache.annontation.MultiCache;
import com.itshare.video.common.aop.cache.core.Unit;
import com.itshare.video.common.core.constant.enums.ApiInfo;
import com.itshare.video.common.dto.Result;
import com.itshare.video.mapper.CategoryMapper;
import com.itshare.video.pojo.po.Category;
import com.itshare.video.pojo.po.CategoryExample;
import com.itshare.video.service.CategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author lyr
 * @create 2020/10/24 08:42
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;


    @Override
    @MultiCache(remoteCacheTime = 6,unit = Unit.HOUR,spel = "'categorylist_'")
    // @RedisCache(duration= 6,unit = Unit.HOUR,spel = "'categoryssList'")

    public Result<List<Category>> getCategoryList() {
        CategoryExample categoryExample = new CategoryExample();
        List<Category> re
                = categoryMapper.selectByExample(categoryExample);

        return Result.<List<Category>>of(ApiInfo.OK)
                .setData(re);
    }


}
